package com.zzz.mylitho;

import static com.facebook.yoga.YogaEdge.ALL;

import android.graphics.Color;
import com.facebook.litho.Column;
import com.facebook.litho.Component;
import com.facebook.litho.ComponentContext;
import com.facebook.litho.annotations.LayoutSpec;
import com.facebook.litho.annotations.OnCreateLayout;
import com.facebook.litho.annotations.Prop;
import com.facebook.litho.widget.SolidColor;
import com.facebook.litho.widget.Text;

/**
 * Created by zhaojh on date 2019/10/22
 */

@LayoutSpec
public class ListItemSpec {
    
    @OnCreateLayout
    static Component onCreateLayout(ComponentContext c, @Prop int color, @Prop String title, @Prop String subtitle,@Prop int shadowRadius) {
        
        return Column.create(c).paddingDip(ALL, 16)
            .backgroundColor(color)
            .child(SolidColor.create(c).color(Color.BLUE).widthDip(100).heightDip(8))
            .child(Text.create(c).text(title).textSizeSp(40).shadowRadiusSp(shadowRadius))
            .child(Text.create(c).text(subtitle).textSizeSp(20).flexGrow(1f))
            .build();
    }
    
    
}
